home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / tm4dhost.zip / TM4DHOST.SCR < prev    next >
Text File  |  1993-11-27  |  46KB  |  1,228 lines

  1. ; Original Host Script done by "TSUNG HU", The Telemate Author.
  2. ; THE PROCEDURE "ShowScreen" IS COPYRIGHTED by "Ed Kapuscinski jr".
  3. ; I RETAIN ALL RIGHTS TO IT NOW AND IN THE FUTURE.
  4. ; I am "Ed Kapuscinski Jr", and I am the Author of this Script!
  5. ; The latest revision date of this script is NOV. 28, 1993
  6. ; Everything in this script file has been tested and found sound.
  7. ; This Script File works as Perfect as I could get it to.
  8. ;
  9. ; IF YOU ARE "NOT" EXPERIENCED IN TELEMATE SCRIPT LANGUAGE.
  10. ; Please, Don't change any code that is there for a reason!
  11. ;
  12. ; I WILL NOT BE RESPONSIBLE FOR ANY DAMAGE THIS SCRIPT FILE
  13. ; DOES TO YOUR MACHINE, OR SOFTWARE.
  14. ;
  15. ; The files "TM4dPASS.HST" & "TM.USE" are updated with this script.
  16. ;
  17. ; ALL THE CHANGES THAT HAVE BEEN MADE ARE CLEARLY MARKED WITH AN
  18. ; ASTERISK " * ", THREW OUT THE SCRIPT IN THE COMMENT LINE!
  19. ;
  20. ; ** In ALL future host Script Menus. **
  21. ; ** Numbers will execute original, Host Options. **
  22. ; ** This will allow over 30 options on Every Menu. **
  23. ; ** If there is a need, There will now be room for their commands. **
  24. ;
  25. ; constant
  26. ;
  27. TRUE = 1
  28. FALSE = 0
  29. FOREVER = TRUE
  30. FILEDIR = "\HOST.DIR"                      ; temp. file for F)ile command
  31. ;
  32. ; global variable
  33. integer local,userlevel,exist,xport,tmcolor
  34. string username,password,filename,ch,file
  35. integer NEWUSER,TMUSER,SILVER,GOLD,LEVEL5,LEVEL6,LEVEL7,LEVEL8,SYSOP,DETECTBAUD,INITIALBAUD,YELLTIME,YELLSOUND,CLOSESYSTEM
  36. string HOSTDIR,DOWNLOADDIR,UPLOADDIR
  37. ;
  38. integer oldAlarmTime,oldAlarmSound,oldZAuto,oldZRecovery,oldBaud,oldConnection
  39. string oldDirUpload
  40. string dospass,pass1,pass2
  41. tmcolor = false
  42. DOSPASS = "Ed Kapuscinski" ; * ESTABLISH DOS ENTRY PASSWORD (MAYBE 1 OR MORE CHARACTORS)
  43. PASS1 = "TELEMATE412"
  44. PASS2 = "SS #NUMBER"
  45.    ; * ---------- Procedure Break ------------    ; * added to let show start
  46.    procedure StoreOptions                         ; * and finish of procedures
  47.    query alarmtime,oldAlarmTime
  48.    query alarmsound,oldAlarmSound
  49.    query dirupload,oldDirUpload
  50.    query zautodownload,oldZAuto
  51.    query zrecovery,oldZRecovery
  52.    query baud,oldBaud
  53.    query connection,oldConnection
  54.    endproc
  55.    ; * ---------- Procedure Break ------------
  56.    procedure RestoreOptions
  57.    set alarmtime,oldAlarmTime
  58.    set alarmsound,oldAlarmSound
  59.    set dirupload,oldDirUpload
  60.    set zautodownload,oldZAuto
  61.    set zrecovery,oldZRecovery
  62.    set baud,oldBaud
  63.    set connection,oldConnection
  64.    endproc
  65.    ; * ---------- Procedure Break -------------
  66.    procedure CheckDirectory string dir
  67.    integer l,pos
  68.    string ch,firstdir
  69.    strpos dir,";",pos
  70.    if pos>0
  71.       substr dir,1,pos-1,firstdir
  72.       dir = firstdir
  73.    endif
  74.    length dir,l
  75.    if l>0
  76.       substr dir,l,1,ch
  77.       if ch<>"\" and ch<>":"
  78.          concat dir,"\"
  79.       endif
  80.    endif
  81.    endproc
  82.    ; * ---------- Procedure Break --------------
  83.    procedure HostConfig                    ; read the configuration file
  84.    string s,ch                             ; * new name TM4d_CFG.HST from the current directory
  85.    open "TM4d_CFG.HST"
  86.    if success
  87.       read s
  88.       atoi s,NEWUSER                       ; new user level
  89.       read s
  90.       atoi s,TMUSER                        ; * TmUser Security level
  91.       read s                               ; *
  92.       atoi s,SILVER                        ; * Alternate levels start here
  93.       read s                               ; *
  94.       atoi s,GOLD                          ; *
  95.       read s                               ; *
  96.       atoi s,LEVEL5                        ; *
  97.       read s                               ; *
  98.       atoi s,LEVEL6                        ; *
  99.       read s                               ; *
  100.       atoi s,LEVEL7                        ; *
  101.       read s                               ; *
  102.       atoi s,LEVEL8                        ; *
  103.       read s                               ; *
  104.       atoi s,SYSOP                         ; * New Sysop Level
  105.       read s                               ; *
  106.       atoi s,DETECTBAUD                    ; detect baud rate
  107.       read s
  108.       atoi s,INITIALBAUD                   ; initial baud rate
  109.       read s
  110.       atoi s,YELLTIME                      ; yell time
  111.       read s
  112.       atoi s,YELLSOUND                     ; yell sound
  113.       read HOSTDIR                         ; directory containing H*.HST
  114.       read DOWNLOADDIR                     ; download directory
  115.       read UPLOADDIR                       ; upload directory
  116.       read s
  117.       atoi s,CLOSESYSTEM                   ; open or close system
  118.       close
  119.       CheckDirectory HOSTDIR
  120.       CheckDirectory DOWNLOADDIR
  121.       CheckDirectory UPLOADDIR
  122.       set alarmtime,YELLTIME               ; setup yell alarm
  123.       set alarmsound,YELLSOUND
  124.       set dirupload,UPLOADDIR              ; setup upload directory
  125.    else
  126.       print "Cannot open TM4d_CFG.HST in the current directory"
  127.       print
  128.       print "Do you want to setup host mode (y/n)? ",
  129.       repeat
  130.          inputch ch
  131.       until success
  132.       if ch="y"
  133.          print ch
  134.          RestoreOptions
  135.          script "TM4dHCFG"                 ; chain to TM4dHCFG.SCR
  136.       else
  137.          print "n"                         ; abort host mode
  138.          print "Host mode aborted"
  139.          stop
  140.       endif
  141.    endif
  142.    endproc
  143.    ; * -------- Procedure Break -------------
  144.    procedure HostBegin
  145.    set zautodownload,off
  146.    set zrecovery,off
  147.    set baud,INITIALBAUD
  148.    clear key                               ; clear keyboard buffer
  149.    clear com                               ; clear com buffer
  150.    clear text
  151.    print
  152.    print "Initializing modem"
  153.    put "^)",                               ; send modem answer string
  154.    if connected
  155.       print "Carrier signal is high, trying to make it reflect the online status"
  156.       put "~AT&C1^M~",                     ; make carrier signal reflect online status
  157.       if connected
  158.          print "Carrier signal is still high, host mode may not work correctly"
  159.          print "Please check your modem manual for correct DIP switch setting"
  160.       else
  161.          print "Carrier signal is now correct"
  162.       endif
  163.       print
  164.    endif
  165.    put "~ATQ0E0X4^M~",                     ; disable responds from modem
  166.    print "                     * * *  TELEMATE ENHANCED HOST v4D * * *^M^J"
  167.    print "                 * * * COPYRIGHT by Edward Kapuscinski Jr * * *"
  168.    print "         * * * THIS SCRIPT MAYBE DISTRIBUTED BUT I RETAIN ALL RIGHTS * * *^M^J"
  169.    print "Press 'L' for local mode, 'C' for configuration,"
  170.    print "      [Esc] to exit and [Alt-H] to terminate user.^M^J"
  171.    print ".............................. Waiting for Caller ............................."
  172.    clear key                               ; clear keyboard buffer
  173.    clear com                               ; clear com buffer
  174.    endproc
  175.    ; * ---------- Procedure Break ------------
  176.    procedure HostEnd
  177.    clear key                               ; clear keyboard buffer
  178.    clear com                               ; clear com buffer
  179.    print
  180.    print "Ending host mode"
  181.    put "^(","~",                           ; send modem init string
  182.    print
  183.    delete FILEDIR                          ; delete temp file
  184.    RestoreOptions
  185.    usage "Host: End session"
  186.    stop
  187.    endproc
  188.    ; * ---------- Procedure Break ------------
  189.    procedure Disconnect                    ; end session
  190.    delay 10
  191.    if not local
  192.       hangup
  193.    endif
  194.    set connection,modem
  195.    local = FALSE
  196.    endproc
  197.    ; * ---------- Procedure Break ------------
  198.    procedure Output string s
  199.    print s,
  200.    if not local
  201.       put s,
  202.    endif
  203.    endproc
  204.    ; * ---------- Procedure Break ------------
  205.    procedure InputChar string ch           ; input and display locally
  206.    repeat
  207.       if not local
  208.          getch ch
  209.       endif
  210.       if local or not success
  211.          inputch ch
  212.          if success
  213.             if ch = "^["
  214.                HostEnd                     ; abort by operator
  215.             endif
  216.             print ch,
  217.          endif
  218.       endif
  219.    until success or not connected
  220.    endproc
  221.    ; * ---------- Procedure Break ------------
  222.    procedure InputEcho string ch           ; input and echo to remote
  223.    InputChar ch
  224.    if not local
  225.       put ch,
  226.    endif
  227.    if ch = "^M"                            ; add line feed
  228.       Output "^J"
  229.    endif
  230.    endproc
  231.    ; * ---------- Procedure Break ------------
  232.    procedure DotEcho string ch             ; input and echo "." to remote
  233.    InputChar ch
  234.    if not local
  235.       if ch="^H" or ch="^M"
  236.          put ch,
  237.       else
  238.          put ".",                          ; echo with "."
  239.       endif
  240.    endif
  241.    if ch = "^M"                            ; add line feed
  242.       Output "^J"
  243.    endif
  244.    endproc
  245.    ; * ---------- Procedure Break ------------
  246.    procedure InputString string str        ; input a string
  247.    string ch
  248.    str = ""
  249.    repeat
  250.       InputEcho ch
  251.       if ch <> "^M"
  252.          if ch = "^H"
  253.             if str = ""
  254.                Output " "
  255.             else
  256.                Output " ^H"
  257.             endif
  258.          endif
  259.          concat str,ch
  260.       endif
  261.    until ch = "^M" or not connected
  262.    if str="" or not connected
  263.       success = FALSE
  264.    else
  265.       success = TRUE
  266.    endif
  267.    endproc
  268.    ; * ---------- Procedure Break ------------
  269.    procedure InputFilename string filename,dir
  270.    string name
  271.    integer pos
  272.    InputString name                        ; input a filename
  273.    repeat
  274.       strpos name,":",pos                  ;  strip drive part
  275.       if pos>0
  276.          strdel name,1,pos
  277.       endif
  278.    until pos=0 or not connected
  279.    repeat
  280.       strpos name,"\",pos                  ; strip directory part
  281.       if pos>0
  282.          strdel name,1,pos
  283.       endif
  284.    until pos=0 or not connected
  285.    if name="" or not connected
  286.       success = FALSE
  287.       filename = ""
  288.    else
  289.       success = TRUE
  290.       filename = dir
  291.       concat filename,"\"                  ; concat <dir>
  292.       strpos filename,"\\",pos
  293.       if pos>0
  294.          strdel filename,pos,1             ; avoid root directory"
  295.       endif
  296.       concat filename,name
  297.    endif
  298.    endproc
  299.    ; * ---------- Procedure Break ------------
  300.    procedure InputPassword string password ; input password
  301.    password = ""
  302.    repeat
  303.       DotEcho ch
  304.       if ch <> "^M"
  305.          if ch = "^H"
  306.             if password = ""
  307.                Output ""
  308.             else
  309.                Output " ^H"
  310.             endif
  311.          endif
  312.          concat password,ch
  313.       endif
  314.    until ch = "^M" or not connected
  315.    if password="" or not connected
  316.       success = FALSE
  317.    else
  318.       success = TRUE
  319.    endif
  320.    endproc
  321.    ; * ---------- Procedure Break ------------
  322.    procedure CheckUser string username,password,integer level,valid
  323.    integer found,pos1,pos2
  324.    string record,name,pass,lev
  325.    strpos username,";",pos1     ; record format: "first last;password#level"
  326.    strpos username,"#",pos2
  327.    if pos1>0 or pos2>0
  328.       valid = FALSE
  329.       return
  330.    endif
  331.    strpos password,";",pos1     ; check password for invalid character
  332.    strpos password,"#",pos2     ;  prevent "#2" etc
  333.    if pos1>0 or pos2>0
  334.       valid = FALSE
  335.       return
  336.    endif
  337.    file = HOSTDIR
  338.    concat file,"TM4dPASS.HST"              ; * New password list name
  339.    open file                               ; * passwords in TM4dPASS.HST
  340.    if not success
  341.       create file
  342.    endif
  343.    if not success
  344.       Output "System error, please call again later^M^J"
  345.       print "SYSOP: Cannot create TM4dPASS.HST"                 ; *
  346.       Disconnect
  347.       alarm "SYSOP: Cannot create TM4dPASS.HST, disk full ?"    ; *
  348.       return
  349.    endif
  350.    found = FALSE
  351.    read record
  352.    while success and not found
  353.       strpos record,";",pos1               ; get fields from the record
  354.       strpos record,"#",pos2
  355.       if pos1>0 and pos2>0
  356.          substr record,1,pos1-1,name
  357.          substr record,pos1+1,pos2-pos1-1,pass
  358.          if name=username
  359.             found = TRUE
  360.             if pass=password
  361.                valid = TRUE
  362.                substr record,pos2+1,1,lev
  363.                atoi lev,level
  364.                username = name
  365.             else
  366.                valid = FALSE
  367.             endif
  368.          endif
  369.       endif
  370.       if not found
  371.          read record
  372.       endif
  373.    endwhile
  374.    if not found                            ; new users
  375.       if CLOSESYSTEM
  376.          valid = FALSE
  377.       else
  378.          seek -1                           ; add user if open system
  379.          write username,";",password,"#",newuser   ; * NewUserLevel is now NewUser
  380.          level = 1                         ; assign new user to level 1
  381.          valid = TRUE
  382.       endif
  383.    endif
  384.    close
  385.    endproc
  386.    ; * ---------- Procedure Break ------------
  387.    procedure Pause                         ; request a key
  388.    string ch
  389.    Output "Press [Enter] to continue "
  390.    InputEcho ch
  391.    Output "^M^J"
  392.    if ch<>"^M"
  393.       Output "^M^J"
  394.    endif
  395.    endproc
  396.    ; * ---------- Procedure Break ------------
  397.    procedure TypeFile string filename,integer more
  398.    string ch                               ; display a file
  399.    integer i
  400.    i = 0
  401.    open filename
  402.    if not success
  403.       Output "File not found.^M^J"
  404.       delay 10
  405.       clear text
  406.    else
  407.       while success
  408.          inputch ch
  409.          if success and ch = "^C"          ; operator break
  410.             clear com
  411.             Output "^M^J"
  412.             exit
  413.          endif
  414.          if not local
  415.             getch ch
  416.             if success and ch = "^C"       ; caller break
  417.                clear com
  418.                Output "^M^J"
  419.                exit
  420.             endif
  421.          endif
  422.          read s                            ; display a line
  423.          Output s
  424.          Output "^M^J"
  425.  
  426.          i = i+1
  427.          if i = 22 and more                ; pause if <more> is TRUE
  428.             i = 0
  429.             Output "^M^JPress SpaceBar for -more-,or Control-C to End "   ; * added
  430.             InputChar ch     ; * Control-C ends display can be now be seen
  431.             if ch = "^C"
  432.                clear com
  433.                Output "^M^J"
  434.                exit
  435.             endif
  436.             Output "^M                                                  ^M" ; * added
  437.          endif
  438.       endwhile
  439.       close
  440.       if more
  441.          Pause
  442.       endif
  443.    endif
  444.    endproc
  445.    ; * ---------- Procedure Break ------------
  446.    procedure Directory string dir          ; display download directory
  447.    string cmd
  448.    cmd = "DIR "                            ; DIR
  449.    concat cmd,dir                          ; DIR \DOWNLOAD\
  450.    concat cmd,"*.* >"                      ; DIR \DOWNLOAD\*.* >
  451.    concat cmd,FILEDIR                      ; DIR \DOWNLOAD\*.* >\HOST.DIR
  452.    dos cmd                                 ; shell to DOS
  453.    TypeFile FILEDIR,TRUE                   ; display \HOST.DIR
  454.    endproc
  455.    ; * ---------- Procedure Break ------------
  456.    procedure FileTransfer string mode,protocol,filename
  457.    print "^M^JPlease start your transfer procedure or press Ctrl-X to abort^M^J"
  458.    delay 10
  459.    if mode = "r"
  460.       if filename=""                       ; receive batch files
  461.          receive protocol
  462.       else
  463.          receive protocol,filename         ; receive single file
  464.       endif
  465.    else
  466.       send protocol,filename               ; send multiple files
  467.    endif
  468.    if success
  469.       Output "File transfer completed^M^J"
  470.       Delay 10                             ; * delay screen erase for possible error messages
  471.    else
  472.       Output "File transfer aborted^M^J"
  473.       delay 10                             ; * delay screen erase for possible error messages
  474.   endif
  475.    Pause
  476.    endproc
  477.    ; * ---------- Procedure Break ------------
  478.    procedure ShowScreen string tmscreen        ; * Procedure (ShowScreen) is Copyrighted by Ed Kapuscinski jr
  479.    string file                                 ; * saves current screen for later viewing
  480.    file = HOSTDIR                              ; * or instant viewing,
  481.    concat file,Tmscreen                        ; *
  482.    clear text                                  ; *
  483.    TypeFile file,FALSE                         ; *
  484.    concat file,Tmscreen                        ; *
  485.    endproc                                     ; *
  486.    ; * ---------- Procedure Break ------------
  487.    procedure ShowNote string tmnote            ; * Show Note will allow you to install as
  488.    string file                                 ; * many Notices or Bullitons as you want to.
  489.            file = HOSTDIR                      ; * Providing that they are at the start of the script.
  490.            concat file,tmnote                  ; * To install more Notices, follow the way the keywords
  491.            FileExist file,exist                ; * are placed, and copy  as many as you like to.
  492.              if exist                          ; * I have also included blank notices in the Zipfile.
  493.               TypeFile file,TRUE               ; *
  494.              endif                             ; *
  495.    endproc                                     ; *
  496.    ; * ---------- Procedure Break ------------
  497.    procedure WaitForCall                  ; wait for connected
  498.    integer i,len,valid,exist,baudrate
  499.    string file
  500.    set connection,modem
  501.    local = FALSE
  502.    xport = FALSE
  503.    tmcolor = FALSE                         ; * establish no color as default
  504.    while not connected                     ; wait for carrier signal
  505.       inputch ch                           ; sysop commands
  506.       if success
  507.          switch ch
  508.            case "^[":                      ; abort
  509.               HostEnd
  510.            case "L":                       ; local mode
  511.               set connection,computer      ; this will set connected = 1
  512.               local = TRUE
  513.            case "C":                       ; configuration
  514.               RestoreOptions
  515.               script "TM4dHCFG"            ; chain to TM4dHCFG.SCR
  516.          endswitch
  517.       endif
  518.    endwhile
  519.    if not local and DETECTBAUD
  520.       waitfor "CONNECT^M","CONNECT 1200","CONNECT 2400","CONNECT 9600","CONNECT 19200","CONNECT 38400",10
  521.       if found
  522.          switch found
  523.             case 1: baudrate = 300
  524.             case 2: baudrate = 1200
  525.             case 3: baudrate = 2400
  526.             case 4: baudrate = 9600
  527.             case 6: baudrate = 19200
  528.             case 7: baudrate = 38400  ; * added higher baudrate
  529.          endswitch
  530.          set baud,baudrate
  531.          Output "Connected at "
  532.          if not local
  533.             put baudrate,"^M^J"
  534.          endif
  535.          print baudrate
  536.       endif
  537.    endif
  538.    Output "^M^J"
  539.    delay 5
  540.    clear com
  541.    delay 5
  542.    file = HOSTDIR
  543.    Output "                  * ╔═════════════════════════════════════════╗ *^M^J"          ; *
  544.    Output "         * * * * *  ║ If your Terminal Supports Ansi Graphics ║  * * * * *^M^J" ; *
  545.    Output "                  * ╚═════════════════════════════════════════╝ *^M^J^M^J"      ; *
  546.    Output "Would you like to view Color Menus [y/N]? "  ; * No color is the Default but Pressing "C" will toggle it. ; *
  547.    InputString ch
  548.    if ch="y"
  549.      tmcolor = true
  550.    else
  551.      tmcolor = false
  552.    endif
  553.  if tmcolor
  554.     ShowScreen "tmhelo_a.hst"               ; * show ansi hello screen
  555.  else
  556.     ShowScreen "tmhelo_x.hst"               ; * show text hello screen
  557.  endif
  558.  
  559.    i = 1
  560.    len = 0
  561.    username = ""                           ; enter name (at most 3 times)
  562.    while i<=3 and len<4 and connected
  563.       Output "Please enter your First and Last name: "
  564.       InputString username
  565.       i = i+1
  566.       length username,len                  ; check the length of name
  567.       if len<4
  568.          Output "Name too short, please try again^M^J^M^J"
  569.          delay 10
  570.       else
  571.          Output "( "                       ; * made full sentence out of logon
  572.          Output  USERNAME                  ; * logon name now shown in braces
  573.          Output " ),Is This Correct "      ; *
  574.          Output "[y/N]? "                  ; *
  575.          InputString ch                    ; * changed [Y/n?]  default is No
  576.        if not ch="y"                       ; * Only "Y" & enter are excepted
  577.             len=0                          ; * After 3 tries,caller is disconnected
  578.          endif
  579.       endif
  580.    endwhile
  581.    if len<4 and connected
  582.       Output "Goodbye^M^J"
  583.       delay 10
  584.       Disconnect
  585.    else
  586.       i = 1
  587.       len = 0
  588.       password = ""                         ; enter password (at most 3 times)
  589.       while i<=3 and len<4 and connected
  590.          Output "Password: "
  591.          InputPassword password
  592.          i = i+1
  593.          length password,len                ; check the length of ot
  594.          if len<4
  595.             Output "Password too short, please try again^M^J^M^J"
  596.          endif
  597.       endwhile
  598.        if len>=4                            ; check password and get user level
  599.          CheckUser username,password,userlevel,valid
  600.        endif
  601.      if (len<4 or not valid) and connected
  602.          Output "Invalid password, access denied^M^J^M^J"
  603.          Disconnect
  604.      else
  605.          log = "Host: Connect to "
  606.          concat log,username
  607.          usage log
  608.        if tmcolor = true
  609.          if userlevel=1
  610.           ShowNote "tmnote1a.hst"             ; * Show Ansi New User Note
  611.           clear text
  612.           ShowNote "tm4d_nta.hst"             ; * Show Ansi Enhanced Note
  613.           clear text                          ; * clear screen
  614.           ShowNote "Yournt_a.hst"             ; * Show Ansi YourNote Notice
  615.          elseif userlevel>1
  616.           ShowNote "tmnote2a.hst"             ; * Show Ansi Host User Note
  617.           clear text                          ; * clear screen
  618.           ShowNote "tm4d_nta.hst"             ; * Show Ansi Enhanced Note
  619.           clear text                          ; * clear screen
  620.           ShowNote "Yournt_a.hst"             ; * Show Ansi YourNote
  621.          endif
  622.        else
  623.          if userlevel=1
  624.           ShowNote "tmnote1x.hst"             ; * Show Text New User Note
  625.           clear text
  626.           ShowNote "tm4d_ntx.hst"             ; * Show Text Enhanced Host Note
  627.           clear text
  628.           ShowNote "Yournt_x.hst"             ; * Show Text YourNote Note
  629.          elseif userlevel>1
  630.           ShowNote "tmnote2x.hst"             ; * Show Text Host User Note
  631.           clear text
  632.           ShowNote "tm4d_ntx.hst"             ; * Show Text Enhanced host note
  633.           clear text
  634.           ShowNote "Yournt_x.hst"             ; * Show Text YourNote Note
  635.          endif
  636.        endif
  637.      endif
  638.    endif
  639.    endproc
  640.    ; * ---------- Procedure Break ------------
  641.    procedure ChatMode                      ; chat mode
  642.    integer x
  643.    string rch,lch
  644.    Output "You have Entered the Twilight Zone:^M^J"
  645.    Keystroke "^MThis is your Sysop Speaking, What can I do for you?^M^J"  ; * changed
  646.    repeat
  647.       if not local
  648.          getch rch
  649.          if success
  650.             put rch,
  651.             if rch = "^M"
  652.  
  653.               Output "^J"
  654.             endif
  655.             wherex x
  656.             if rch = " " and x > 65
  657.                Output "^M^J"
  658.             endif
  659.          endif
  660.       endif
  661.       inputch lch
  662.       if success and lch<>"^["             ; abort if sysop press [Esc]
  663.          Output lch
  664.          if lch = "^M"
  665.             Output "^J"
  666.          endif
  667.          wherex x
  668.          if lch = " " and x > 65
  669.             Output "^M^J"
  670.          endif
  671.       endif
  672.    until lch="^[" or not connected
  673.    Output "^MSpeak your Mind, I always say.^M^JIt's been a pleasure!^M^J"  ; * place what you want displayed here
  674.    delay 10
  675.    Output "^M^JChat mode end:^M^J^M^J"
  676.    Pause
  677.    endproc
  678.    ; * ---------- Procedure Break ------------
  679.    procedure DoCommand                  ; do a command
  680.    if xport
  681.       clear text                                                 ; * added
  682.     if userlevel=NEWUSER ; * Using the "=" Only New User see's this menu
  683.       Output " Welcome to The New Enhanced Telemate Host v4d ( "
  684.       Output  username 
  685.       Output " )!^M^J"
  686.       Output "╓─────────────────────────────────────────────────────────────╖^M^J"  ; * Numbers will now be used to execute
  687.       Output "║ To TOGGLE:Press (5)ExPert  *  (C) Color Mode  *  (O)Options ║^M^J"  ; * Original Host Options.
  688.       Output "╟─────────────────────────────────────────────────────────────╢^M^J"  ; *
  689.       Output "║ (2)D/L, (3)CHAT, (4)TYPE, (5)EXPERT, (6)FILES,   (G)GOODBYE ║^M^J"  ; *
  690.       Output "╚═════════════════════════════════════════════════════════════╝^M^J"  ; *
  691.       Output "Command 2,3,4,5,6,C,O,[G]: "                                          ; * expert mode
  692.  
  693.     elseif userlevel>NEWUSER ; * Every level except Newuser see's this Menu         ; *
  694.       Output " Well now that you are a Host User "                                  ; *
  695.       Output  username                                                              ; *
  696.       Output ", Give till it HURTS!^M^J"                                                 ;
  697.       Output "╓─────────────────────────────────────────────────────────────╖^M^J"  ; * Host User and NewUser Expert Menus
  698.       Output "║ To Toggle:Press (5)ExPert  *  (C)Color Mode  *   (O)Options ║^M^J"  ; *
  699.       Output "╟─────────────────────────────────────────────────────────────╢^M^J"  ; *
  700.       Output "║ (1)U/L,  (2)D/L,  (3)CHAT,  (4)TYPE,  (5)EXPERT, (6)FILES,  ║^M^J"  ; *
  701.       Output "║ (7)SHELL, (8)BATCH, (9)SHUTDOWN <SYSOP ONLY)     (G)GOODBYE ║^M^J"  ; *
  702.       Output "╚═════════════════════════════════════════════════════════════╝^M^J"  ; *
  703.       Output "Command 1,2,3,4,5,6,C,O,(7,8,9),[G]: "                                 ; expert mode
  704.     endif
  705.  
  706.    else
  707.     if userlevel=SYSOP                    ; * menu selection starts here
  708.         Output "^M^J^M^J"                 ; * menu will be chosen by userlevel
  709.       if tmcolor = true                   ; *
  710.         ShowScreen "Tm4d9a.hst"           ; *
  711.         Output "Command: "
  712.  
  713.       else
  714.         ShowScreen "Tm4d9x.hst"           ; *
  715.         Output "Command: "
  716.  
  717.       endif
  718.     elseif userlevel=LEVEL8               ; * start of user menu selection
  719.         Output "^M^J^M^J"                 ; *
  720.       if tmcolor = true                   ; *
  721.         ShowScreen "Tm4d8a.hst"           ; * show ansi screen
  722.         Output "Command: "                ; *
  723.  
  724.       else
  725.         ShowScreen "Tm4d8x.hst"           ; * show text screen
  726.         Output "Command: "                ; *
  727.  
  728.       endif
  729.     elseif userlevel=LEVEL7               ; *
  730.         Output "^M^J^M^J"                 ; *
  731.       if tmcolor = true                   ; *
  732.         ShowScreen "Tm4d7a.hst"           ; * show ansi screen
  733.         Output "Command: "                ; *
  734.  
  735.       else
  736.         ShowScreen "Tm4d7x.hst"           ; * show text screen
  737.         Output "Command: "                ; *
  738.  
  739.       endif
  740.     elseif userlevel=LEVEL6               ; *
  741.         Output "^M^J^M^J"                 ; *
  742.       if tmcolor = true                   ; *
  743.         ShowScreen "tm4d6a.hst"           ; * show ansi screen
  744.         Output "Command: "                ; *
  745.  
  746.       else
  747.         file = HOSTDIR                    ; *
  748.         ShowScreen "Tm4d6x.hst"           ; * show text screen
  749.         Output "Command: "                ; *
  750.  
  751.       endif
  752.     elseif userlevel=LEVEL5               ; *
  753.         Output "^M^J^M^J"                 ; *
  754.      if tmcolor = true                    ; *
  755.         ShowScreen "tm4d5a.hst"           ; * show ansi screen
  756.         Output "Command: "
  757.  
  758.      else
  759.         ShowScreen "tm4d5x.hst"           ; * show text screen
  760.         Output "Command: "                ; *
  761.  
  762.      endif
  763.     elseif userlevel=GOLD                 ; *
  764.         Output "^M^J^M^J"                 ; *
  765.      if tmcolor = true                    ; *
  766.         ShowScreen "Tm4d4a.hst"           ; * show ansi screen
  767.         Output "Command: "                ; *
  768.  
  769.      else
  770.         file = HOSTDIR                    ; *
  771.         ShowScreen "Tm4d4x.hst"           ; * show text screen
  772.         Output "Command: "                ; *
  773.  
  774.      endif
  775.     elseif userlevel=SILVER               ; *
  776.         Output "^M^J^M^J"                 ; *
  777.      if tmcolor = true                    ; *
  778.         ShowScreen "Tm4d3a.hst"
  779.         Output "Command: "                ; *
  780.  
  781.      else
  782.         ShowScreen "Tm4d3x.hst"
  783.         Output "Command: "                ; *
  784.  
  785.      endif
  786.     elseif userlevel=TMUSER               ; *
  787.         Output "^M^J^M^J"                 ; * This menu would be the standard
  788.      if tmcolor = true                    ; *
  789.         ShowScreen "Tm4d2a.hst"           ; * show ansi screen
  790.         Output "Command: "                ; *
  791.  
  792.      else
  793.         ShowScreen "Tm4d2x.hst"           ; * show text screen
  794.         Output "Command: "                ; *
  795.  
  796.      endif
  797.     elseif userlevel=NEWUSER              ; * Start of New User Menu
  798.         Output "^M^J^M^J"                 ; * Caller will not have
  799.      if tmcolor = true
  800.         ShowScreen "Tm4d1a.hst"           ; * show ansi screen
  801.         Output "Command: "                ; *
  802.  
  803.      else
  804.         ShowScreen "Tm4d1x.hst"           ; * show text screen
  805.         Output "Command: "                ; *
  806.      endif
  807.     endif
  808.    endif
  809.    InputEcho ch
  810.    if ch<>"^M"
  811.       Output "^M^J"
  812.    endif
  813.    switch ch
  814.       case "6":                           ; file directory
  815.          clear text                       ; * clears old, for the new display
  816.          Directory DOWNLOADDIR
  817.       case "4":                           ; type a file
  818.          Output "^M^JEnter filename: "
  819.          InputFilename filename,DOWNLOADDIR
  820.          if success
  821.             clear text
  822.             TypeFile filename,TRUE
  823.          endif        
  824.       case "1":
  825.          if userlevel<TMUSER              ; * if userlevel is lest then 2
  826.            if tmcolor=true                ; * can not upload file to host
  827.             ShowScreen "tmrulesa.hst"
  828.             usage "Upload Attempt:"
  829.             pause
  830.            else
  831.             ShowScreen "tmrulesx.hst"
  832.             usage "Upload Attempt:"       ; * write to usage log
  833.             pause
  834.            endif
  835.          else
  836.           if tmcolor = true               ; * color check
  837.             ShowScreen "Tmprot_a.hst"     ; * ansi protocal menu
  838.           else
  839.             ShowScreen "Tmprot_x.hst"     ; * text protocal menu
  840.           endif
  841.             Output "Select protocol: "
  842.             InputEcho protocol
  843.             Output "^M^J"
  844.          if local
  845.             Output "Function not available in local mode^M^J"
  846.             delay 20
  847.          else
  848.             switch protocol
  849.                case "X","R":
  850.                   Output "Enter filename: "
  851.                   InputFilename filename,""
  852.                   if success
  853.                      FileTransfer "r",protocol,filename
  854.                   endif
  855.                case "Z","S","T","M","Y","B","G":
  856.                   FileTransfer "r",protocol,""
  857.             endswitch
  858.          endif
  859.       endif
  860.       case "2":                           ; download a file
  861.          Output "^M^J"
  862.        if tmcolor = true                  ; *
  863.          ShowScreen "Tmprot_a.hst"        ; * show ansi protocal menu
  864.        else
  865.          ShowScreen "Tmprot_x.hst"        ; * show text protocal menu
  866.        endif
  867.          Output "Select protocol: "
  868.          InputEcho protocol
  869.          Output "^M^J"
  870.          if local
  871.             Output "Function not available in local mode^M^J"
  872.             delay 10
  873.          else
  874.             switch protocol
  875.                case "X","Y","Z","S","T","M","R","B","G":   ; * removed hslink till more test
  876.                   Output "Enter filename: "
  877.                   InputFilename filename,DOWNLOADDIR
  878.                   if success
  879.                      FileTransfer "s",protocol,filename
  880.                   endif
  881.             endswitch
  882.          endif
  883.      case "3":                            ; yell
  884.          delay 5
  885.          clear text                                           ; * clears main menu
  886.          Output "^M^J"                                        ; * blank line
  887.          Output "╓─────────────────────────────────────╖^M^J" ; * added
  888.          Output "║ I'll be with you in just a Moment?  ║^M^J" ; * added
  889.          Output "╚═════════════════════════════════════╝^M^J" ; * added
  890.          alarm "Caller would like to speak to you?^JPress [Enter] to accept, [Esc] to deny"
  891.          if success
  892.             clear text                    ; * chat mode is now full screen
  893.             print "^M^JSYSOP: Press [Esc] to Terminate Chat Mode^M^J"   ; * changed text
  894.             ChatMode                                                    ; * added spaces
  895.          else
  896.             delay 10
  897.             clear text                    ; * clear old menu
  898.             Output "^M^J"                 ; * blank line
  899.             Output "╓─────────────────────────────────────╖^M^J"  ; * added
  900.             Output "║ Maybe Later, When I have more time? ║^M^J"  ; * added
  901.             Output "╚═════════════════════════════════════╝^M^J"  ; * added
  902.             Output "^M^J"
  903.             delay 20
  904.          endif
  905.       case "5":                           ; toggle export mode
  906.          xport = not xport
  907.       case "C":
  908.          tmcolor = not tmcolor
  909.       case "G":                           ; goodbye
  910.          file = HOSTDIR
  911.             Output "Do you wish to leave Host Mode? [y/N]? " ; * Caller now has Option
  912.             InputString ch
  913.             if ch="y"
  914.                if tmcolor = true
  915.                  concat file,"TMBYE_A.HST"        ; * color goodbye notice
  916.                  TypeFile file,false
  917.                  delay 30                         ; * increased delay for better viewing
  918.                  Disconnect
  919.                else
  920.                  concat file,"TMBYE_X.HST"        ; * text goodbye notice
  921.                  TypeFile file,false
  922.                  delay 30                         ; * increased delay for better viewing
  923.                  Disconnect
  924.                endif
  925.             endif
  926.       case "7":                           ; shell to DOS
  927.          if userlevel<SYSOP
  928.              Output "^M^JShell out to Dos!^M^J"       ; * put menu title in script
  929.              Output "Sorry, this command is for Sysop only!^M^J"
  930.              usage "Shellout Attempt: (7)"            ; * Writes shellout was tried in log file
  931.              delay 20
  932.          else
  933.             Output "Please Enter the Correct Pass Word? "    ; * PASS CHARACTOR or WORD NEEDED TO SHELLOUT
  934.             inputstring ch                                   ; * PASSWORD maybe any (word,phrase,or single charactor)
  935.             if ch = DOSPASS                                  ; * I used my Name in this illustration to show that spaces are acceptable also!
  936.               if local                                  ; local mode shell to DOS
  937.                  Output "Shelling to DOS ... ^M^J"
  938.                  delay 5
  939.                  dos
  940.                  Output "Return from DOS shell^M^J"
  941.                  delay 5
  942.               else
  943.                  file = HOSTDIR
  944.                  concat file,"HSHELL.BAT"
  945.                  fileexist file,exist              ; check for HSHELL.BAT
  946.                  if exist
  947.                     Output "Shelling to DOS ... ^M^J"
  948.                     delay 5
  949.                     dos file
  950.                     Output "Return from DOS shell^M^J"
  951.                     delay 5
  952.                  else
  953.                     Output "SYSOP: Cannot find HSHELL.BAT^M^J"
  954.                  endif
  955.               endif
  956.             else
  957.               Output "Your name will be entered in the BadNames List!^M^J"   ; * this is usally enough to stop any
  958.               usage "Attempt Shellout-PASSWORD ERROR!"                   ; * intruder from tampering with your system!
  959.               pause                                                      ; * YOUR THE BOSS AROUND HERE
  960.               delay 10
  961.               DISCONNECT
  962.             endif
  963.          endif
  964.       ; * Place include file here to access the other menus.
  965.       ; * If you need 22 more options, there here.
  966.       ; * Like this: #include "d:\tm\script\extra.scr"
  967.       ; * The OPTIONS BELOW are the options that are in "Include file","extra.scr".
  968.       ; * To make the host script faster. Remove the lines from "952-1120".
  969.       ; * They are here as sample options only. Availible not to all Userlevels.
  970.       case "B":
  971.          if userlevel=2 or userlevel=3 or userlevel=9   ; * In this example, every caller except 2,3, or 9 see's the menu
  972.             Output "Your Security level is not enough for this command!^M^J"
  973.             delay 10
  974.          else
  975.             Output "This would be Level (Menu 2)!^M^J"
  976.             pause
  977.          endif
  978.       case "D":
  979.          if userlevel<>sysop
  980.             Output "Your Security level is not enough for this command!^M^J"
  981.             delay 10
  982.          else
  983.             Output "This would be Level (Menu 3)!^M^J"
  984.             pause
  985.          endif
  986.       case "E":
  987.          if userlevel<>2                                   ; * everyone but userlevel 2
  988.             Output "This would be Level (Menu 5)!^M^J"     ; * sees the menu. this is very handy if
  989.             pause                                          ; * you have a problem user.
  990.          else
  991.             Output "Your Security level is not enough for this command!^M^J"
  992.             delay 30
  993.          endif
  994.       case "F":
  995.          if userlevel<>6
  996.             Output "Your Security level is not enough for this command!^M^J"
  997.             delay 10
  998.          else
  999.             Output "This would be Level (Menu 5)!^M^J"
  1000.             pause
  1001.          endif
  1002.       case "H":
  1003.          if userlevel<>4
  1004.             Output "Your Security level is not enough for this command!^M^J"
  1005.             delay 10
  1006.          else
  1007.             Output "This would be Level (Menu 5)!^M^J"
  1008.             pause
  1009.          endif
  1010.       case "I":
  1011.          if userlevel<>8
  1012.             Output "Your Security level is not enough for this command!^M^J"
  1013.             delay 10
  1014.          else
  1015.             Output "This would be Level (Menu 7)!^M^J"
  1016.             pause
  1017.          endif
  1018.       case "J":
  1019.          if userlevel<>9
  1020.             Output "Your Security level is not enough for this command!^M^J"
  1021.             delay 10
  1022.          else
  1023.             Output "This would be Level (Menu 8)!^M^J"
  1024.             pause
  1025.          endif
  1026.       case "K":
  1027.          if userlevel<>sysop
  1028.             Output "Your Security level is not enough for this command!^M^J"
  1029.             delay 10
  1030.          else
  1031.             Output "This would be Level (Menu 9)!^M^J"
  1032.             pause
  1033.          endif
  1034.       case "M":
  1035.          if userlevel=sysop or userlevel=2
  1036.             Output "Your Security level is not enough for this command!^M^J"
  1037.             delay 10
  1038.          else
  1039.             Output "This would be Level (Menu 11)!^M^J"
  1040.             pause
  1041.          endif
  1042.       case "N":
  1043.          if userlevel=1
  1044.          else
  1045.             Output "This would be Level (Menu 12)!^M^J"
  1046.             pause
  1047.          endif
  1048.       case "P":
  1049.          if userlevel<>sysop
  1050.             Output "Your Security level is not enough for this command!^M^J"
  1051.             delay 10
  1052.          else
  1053.             Output "This would be Level (Menu 14)!^M^J"
  1054.             pause
  1055.          endif
  1056.       case "Q":
  1057.          if userlevel<>sysop
  1058.             Output "Your Security level is not enough for this command!^M^J"
  1059.             delay 10
  1060.          else
  1061.             Output "This would be Level (Menu 15)!^M^J"
  1062.             pause
  1063.          endif
  1064.       case "R":
  1065.          if userlevel<>sysop
  1066.             Output "Your Security level is not enough for this command!^M^J"
  1067.             delay 10
  1068.          else
  1069.             Output "This would be Level (Menu 16)!^M^J"
  1070.             pause
  1071.          endif
  1072.       case "S":
  1073.          if userlevel<>sysop
  1074.             Output "Your Security level is not enough for this command!^M^J"
  1075.             delay 10
  1076.          else
  1077.             Output "This would be Level (Menu 17)!^M^J"
  1078.             pause
  1079.          endif
  1080.       case "T":
  1081.          if userlevel<>sysop
  1082.             Output "Your Security level is not enough for this command!^M^J"
  1083.             delay 10
  1084.          else
  1085.             Output "This would be Level (Menu 18)!^M^J"
  1086.             pause
  1087.          endif
  1088.       case "U":
  1089.          if userlevel<>sysop
  1090.             Output "Your Security level is not enough for this command!^M^J"
  1091.             usage "OPTION (U) ATTEMPT: level 9 required"
  1092.             delay 10
  1093.          else
  1094.             Output "This would be Level (Menu 19)!^M^J"
  1095.             pause
  1096.          endif
  1097.       case "V":
  1098.          if userlevel<>sysop
  1099.             Output "Your Security level is not enough for this command!^M^J"
  1100.             usage "OPTION (V) ATTEMPT: level 9 required"
  1101.             delay 10
  1102.          else
  1103.             Output "This would be Level (Menu 20)!^M^J"
  1104.             pause
  1105.          endif
  1106.       case "W":
  1107.          if userlevel<>sysop
  1108.             Output "Your Security level is not enough for this command!^M^J"
  1109.             usage "OPTION (W) ATTEMPT: level 9 required"
  1110.             delay 10
  1111.          else
  1112.             Output "This would be Level (Menu 21)!^M^J"
  1113.             pause
  1114.          endif
  1115.       case "X":
  1116.          if userlevel<>sysop
  1117.             Output "Your Security level is not enough for this command!^M^J"
  1118.             usage "OPTION (X) ATTEMPT: level 9 required"
  1119.             delay 10
  1120.          else
  1121.             Output "This would be Level (Menu 22)^M^J"
  1122.             pause
  1123.          endif
  1124.       case "Y":
  1125.          if userlevel=2 or userlevel=9
  1126.            Output "This would be level (Menu 23)!^M^J"
  1127.            Output "If you can see this. You must be ( "                  ; * usersname is in option
  1128.            Output username
  1129.            Output " )!^M^J"
  1130.            Output "You must be a Host User, Level 2!"
  1131.            Output "Know one else would be able to see this message!^M^J"
  1132.            pause
  1133.          else
  1134.             Output "Your security level is not high enough for this command!^M^J"
  1135.             usage "Option Attempt:(Y) levels 2,8,or 9 required"
  1136.             pause
  1137.          endif
  1138.       case "O":
  1139.          if tmcolor = true
  1140.             ShowScreen "optionsa.hst"          ; * Show Ansi Option Screen
  1141.             pause
  1142.          else
  1143.             ShowScreen "optionsx.hst"          ; * Show Text Option Screen
  1144.             pause
  1145.          endif
  1146.       case "Z":
  1147.          if userlevel=1 or userlevel=3 or userlevel=5 or userlevel=7 or userlevel=9
  1148.            Output "This would be level (Menu 24)!^M^J"
  1149.            Output "What do you think of my Host Script ( "
  1150.            Output username
  1151.            Output " )?^M^J"
  1152.            Output "Know one else would be able to see this message!^M^J"
  1153.            pause
  1154.          else
  1155.             Output "Your security level is not high enough for this command!^M^J"
  1156.             usage "Option Attempt: (Z) levels 1,3,5,7, or 9 required"
  1157.             pause
  1158.          endif
  1159.       case "8":                                  ; run remote program
  1160.          if userlevel<SYSOP
  1161.             Output "^M^JRun Batch File!^M^J"     ; * put menu title in script
  1162.             Output "Sorry, this command is for Sysop Only!^M^J"
  1163.             usage "Run Attempt: (8)Batch"
  1164.             delay 20
  1165.          else
  1166.             Output "Please Enter the Correct PassWord? "    ; * DOS PASS CHARACTOR or WORD NEEDED TO SHELLOUT
  1167.             inputstring ch                                  ; * Establish at start of script in variable
  1168.             if ch = DOSPASS
  1169.               file = HOSTDIR
  1170.               if local                             ; run HLOCAL.BAT if local mode
  1171.                 concat file,"HLOCAL.BAT"
  1172.                 fileexist file,exist
  1173.                 if exist
  1174.                   Output "Loading external program ... ^M^J"
  1175.                   dos file
  1176.                   Output "Return from external program^M^J"
  1177.                 else
  1178.                   Output "SYSOP: Cannot find HLOCAL.BAT^M^J"
  1179.                   delay 20
  1180.                 endif
  1181.              else                                 ; run HREMOTE.BAT if remote mode
  1182.                concat file,"HREMOTE.BAT"
  1183.                fileexist file,exist
  1184.                if exist
  1185.                   Output "Loading remote program ... ^M^J"
  1186.                   dos file
  1187.                   Output "Return from remote program^M^J"
  1188.                else
  1189.                   Output "SYSOP: Cannot find HREMOTE.BAT^M^J"
  1190.                endif
  1191.              endif
  1192.            else
  1193.               Output "You must enter the proper Pass Word!^M^J"
  1194.               pause
  1195.            endif
  1196.          endif
  1197.       case "9":                                  ; shut down host mode
  1198.          if userlevel<SYSOP
  1199.             Output "^M^JEnd Host Mode!^M^J"      ; * put menu title in script
  1200.             Output "Sorry, this command is for Sysop Only!^M^J"
  1201.             usage "Run Attempt: (9)Shutdown"
  1202.             delay 20
  1203.          else
  1204.             Output "^M^JShut Down Host Mode!^J^MAre you sure [y/N]? " ; * added info
  1205.             InputString ch
  1206.             if ch="y"
  1207.                Output "Shutting down host mode^M^J"
  1208.                Disconnect
  1209.                HostEnd
  1210.             endif
  1211.          endif
  1212.    endswitch
  1213.    endproc
  1214.    ; * ---------- Procedure Break ------------
  1215. ;
  1216. ; begin main program
  1217. ;
  1218. StoreOptions
  1219. HostConfig              ; read configuration file TM4d_CFG.HST
  1220. usage "Host: Begin session"
  1221. while FOREVER
  1222.    HostBegin            ; initial mode
  1223.    WaitForCall          ; wait for a call
  1224.    while connected
  1225.       DoCommand         ; do commands
  1226.    endwhile
  1227. endwhile
  1228.